package com.usian.admin.controller;

import com.usian.admin.service.AdSensitiveService;
import com.usian.apis.admin.AdSensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
@Api(value = "敏感词管理",tags = "sensitive",description = "敏感词管理API")
public class AdSensitiveController implements AdSensitiveControllerApi {

    @Autowired
    private AdSensitiveService adSensitiveService;


    @PostMapping("/list")
    @ApiOperation(value = "敏感词列表查询",notes = "根据敏感词进行敏感词列表查询")
    @ApiImplicitParam(name = "dto",type = "SensitiveDto",value = "分页及其信息")
    @Override
    public ResponseResult list(SensitiveDto dto) {
        return adSensitiveService.findList(dto);
    }

    @PostMapping("/save")
    @ApiOperation(value = "敏感词添加",notes = "敏感词列表添加")
    @ApiImplicitParam(name = "adSensitive",type = "AdSensitive",value = "敏感词添加信息")
    @Override
    public ResponseResult add(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.add(adSensitive);
    }

    @PostMapping("/update")
    @ApiOperation(value = "敏感词修改",notes = "敏感词列表修改")
    @ApiImplicitParam(name = "adSensitive",type = "AdSensitive",value = "敏感词修改信息")
    @Override
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.updateByPremaryKey(adSensitive);
    }

    @GetMapping("/del")
    @ApiOperation(value = "敏感词删除",notes = "敏感词列表删除")
    @ApiImplicitParam(name = "id",type = "Integer",value = "敏感词删除id")
    @Override
    public ResponseResult delete(Integer id) {
        return adSensitiveService.delete(id);
    }
}
